{% extends "base.html" %}
{% block content %}
{% if rooms %}
        <br><br>
   There are {{ rooms|length }} rooms:<br/><br/>
   {% for e in rooms %}
        <form method="post" action="/hotels/serve/" onsubmit="alert('Room has been reserved :)')">{% csrf_token %}
            <input type="hidden" name="checkin" value="{{ checkin }}"/>
            <input type="hidden" name="checkout" value="{{ checkout }}"/>
            <input type="hidden" name="roomid" value="{{ e.0 }}"/>
            <td>  RoomId : {{e.0 }} </td><br/>
            <td>  Room : {{ e.1 }} </td><br/>
            <td> Available Rooms : {{ e.2 }} </td><br/>
            {% if e.2 > 0 %}
                <input type="number" name="roomnumber" min="1" max="{{e.2}}" value="1"/>
                <input type="submit" value="Book"/><br/><br/>
            {% else %}
                All rooms units is Reserved within Data Range !!
                <input type="number" name="roomnumber" min="1" max="{{e.2}}" value="0"/>
                <input type="submit" value="Book" disabled/><br/><br/>
            {% endif %}

        </form>
    {% endfor %}
{% else %}
   <br/><br/><br/><br/><br/>
   <center><h1>Not Found !</h1>try other data :)</center>
        <br/><br/><br/><br/><br/><br/><br/><br/><br/>
        <br/><br/><br/><br/><br/><br/><br/><br/>
{% endif %}
{% endblock %}